import React, { Component } from 'react'
import './App.less'
import { withRouter } from 'react-router-dom'
import Mytabbar from "./components/Mytabbar/Mytabbar"
import "./App.less"
class App extends Component {
  render() {
    return (
      <div id='app'>
        {this.props.children}
        <Mytabbar />
      </div>
    )
  }
  // 在渲染之前就让/重新定向到home
  UNSAFE_componentWillMount() {
    console.log(this.props.location.pathname);
    // 拿到当前页面的路径
    if (this.props.location.pathname === "/") {
      // 跳转到/home(重定向)
      this.props.history.push("/home")
    }
  }
}

export default withRouter(App)